package com.jemmyee.pizza.dao;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Repository;

import com.jemmyee.core.dao.BaseDaoImpl;
import com.jemmyee.pizza.entity.ApplyComment;

@Repository("applyCommentDao")
public class ApplyCommentDaoImpl extends BaseDaoImpl<ApplyComment> implements IApplyCommentDao{

	
private static final Log log = LogFactory.getLog(ApplyFlowDaoImpl.class);
	
	
	public List<ApplyComment> findByLimits(String[] limits,String orderby) {
		try {
			
			StringBuffer hql = new StringBuffer(" from ApplyComment where 1=1 ") ;
			
			if(limits != null && limits.length > 0){
				for(String limit : limits){
					if(limit != null && !"".equals(limit)){
						hql.append(" and " + limit + " ") ;
					}
				}
			}
			
			if(orderby != null && !"".equals(orderby))hql.append( " order by " + orderby) ;
			
			return getHibernateTemplate().find(hql.toString());
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}
}
